home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13318 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: lrz-muenchen.de!news
  2. From: watzka@stat.uni-muenchen.de (Kurt Watzka)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help:what is wrong this code?
  5. Date: 6 Apr 1996 10:09:50 GMT
  6. Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
  7. Distribution: world
  8. Message-ID: <4k5fte$163@sparcserver.lrz-muenchen.de>
  9. References: <4k3p3q$n76@brahms.udel.edu> <31662D76.96A@public.sta.net.cn>
  10. NNTP-Posting-Host: sun2.lrz-muenchen.de
  11.  
  12. Xu Yifeng <jafd@public.sta.net.cn> writes:
  13.  
  14. >Yue-hong Zheng wrote:
  15. >/> 
  16. >/> Why it give me 0.0000?
  17. >/> 
  18. >/> #include <stdio.h>
  19. >/> main () {
  20. >/> double a=9.008;
  21. >/> printf("%f\n",sqrt(a));
  22. >/> return 0;
  23. >/> }
  24.  
  25. >the format string is error, the sentence should be "printf("%e\n", sqrt(a));"
  26.  
  27. Not so obvious jokes should be marked with something like :-), whereas
  28. sheer sarcasm could sometimes go undeclared. If you want to give a
  29. misleading answer, at least make it possible to detect. 
  30.  
  31. "%f" is as valid as "%e" for printing a double.
  32.  
  33. Kurt
  34. --
  35. | Kurt Watzka                             Phone : +49-89-2180-6254
  36. | watzka@stat.uni-muenchen.de
  37.